<template>
  <el-dialog title="用料清单查询" :visible.sync="showFlag" :modal="false" width="90%" append-to-body>
    <el-table v-loading="loading" :data="dataList" height="calc(60vh)">
      <el-table-column label="序号" align="center" width="50px">
        <template slot-scope="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="物料编码" align="center" prop="itemCode" min-width="100" />
      <el-table-column label="物料名称" align="center" prop="itemName" min-width="100" />
      <el-table-column label="规格" align="center" prop="specification" min-width="180" />
      <el-table-column label="子项类型" align="center" prop="fmaterialType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sub_item_type" :value="scope.row.fmaterialType" />
        </template>
      </el-table-column>
      <el-table-column label="子项单位" align="center" prop="unitName" />
      <el-table-column label="分子" align="center" prop="fnumerator" />
      <el-table-column label="分母" align="center" prop="fdenominator" />
      <el-table-column label="使用比例%" align="center" prop="fuseRate" />
      <el-table-column label="固定损耗" align="center" prop="fFixScrapQty" />
      <el-table-column label="变动损耗率%" align="center" prop="fScrapRate" />
      <el-table-column label="应发数量" align="center" prop="fmustQty" />
      <el-table-column label="已领数量" align="center" prop="quantityIssued" />
      <el-table-column label="未领数量" align="center" prop="quantityNotIssued" />
    </el-table>
  </el-dialog>
</template>

<script>
// reportAll
import { workorderBomLinelist } from "@/api/mes/pro/workorder";
export default {
  name: "workorderBomLinelist",
  dicts: ["sub_item_type"],
  data() {
    return {
      caseInfo: {},
      showFlag: false,
      loading: false,
      dataList: []
    };
  },
  methods: {
    init(row) {
      this.caseInfo.workorderCode = row.workorderCode;
      this.caseInfo.fMoEntryId = row.fmoEntryId;
      this.showFlag = true
      this.getList();
    },
    getList() {
      this.loading = true;
      workorderBomLinelist({ workorderCode: this.caseInfo.workorderCode, fMoEntryId: this.caseInfo.fMoEntryId }).then((res) => {
        this.dataList = res.rows || [];
        this.loading = false;
      }).catch(() => {
        this.dataList = []
        this.loading = true;
      });
    },

  },
};
</script>
<style lang="scss" scoped></style>